<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    function Foo(){
        var count = 0;
        return function(){
            console.log(count);
            count++;
        }
    }
    var fun = Foo();
    fun();
    fun();
    fun();
    fun();
</script>
</body>
</html>